﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ElementalMyDear
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            ShammySettings.myPrefs.Load();

            comboBoxLifeblood.SelectedIndex = ShammySettings.myPrefs.lifeblood;
            comboBoxLifebloodYorN.SelectedIndex = ShammySettings.myPrefs.lifebloodYorN;
            comboBoxShamanisticRage.SelectedIndex = ShammySettings.myPrefs.shamanisticrage;
            comboBoxSearingTotem.SelectedIndex = ShammySettings.myPrefs.searingtotem;
            comboBoxMagmaTotem.SelectedIndex = ShammySettings.myPrefs.magmatotem;
            comboBoxFireElementalTotem.SelectedIndex = ShammySettings.myPrefs.fireelementaltotem;
            comboBoxThunderstorm.SelectedIndex = ShammySettings.myPrefs.thunderstorm;
            comboBoxIntPotionsYesNo.SelectedIndex = ShammySettings.myPrefs.IntPotionsYesNo;
            comboBoxIntPotionsKind.SelectedIndex = ShammySettings.myPrefs.IntPotionsKind;
            comboBoxIntPotionsWhen.SelectedIndex = ShammySettings.myPrefs.IntPotionsWhen;
            comboBox1.SelectedIndex = ShammySettings.myPrefs.HealingStreamTotem;
            comboBoxEarthElementalTotem.SelectedIndex = ShammySettings.myPrefs.earthelementaltotem;
            comboBoxBloodlust.SelectedIndex = ShammySettings.myPrefs.bloodlust;
            comboBoxAscendance.SelectedIndex = ShammySettings.myPrefs.ascendance;
            comboBoxEarthquake.SelectedIndex = ShammySettings.myPrefs.earthquake;
            comboBoxTrinket1.SelectedIndex = ShammySettings.myPrefs.Mtrinket1;
            comboBoxTrinket2.SelectedIndex = ShammySettings.myPrefs.Mtrinket2;
            comboBoxEngiGloves.SelectedIndex = ShammySettings.myPrefs.Mengivloves;
            comboBoxalchemyFlaskYorN.SelectedIndex = ShammySettings.myPrefs.MAlchemyFlask;
            comboBoxIntFlaskYorN.SelectedIndex = ShammySettings.myPrefs.MIntellectFlask;
            comboBoxIntFlaskWhen.SelectedIndex = ShammySettings.myPrefs.MIntellectFlaskWhen;
            comboBoxHealingSurgeYorN.SelectedIndex = ShammySettings.myPrefs.healingsurge;
            comboBoxHealthstoneYorN.SelectedIndex = ShammySettings.myPrefs.healthstone;
            comboBoxLifeSpiritYorN.SelectedIndex = ShammySettings.myPrefs.LifeSpirit;
            comboBoxHelathpotionYorN.SelectedIndex = ShammySettings.myPrefs.healthpotion;
            comboBoxNaruuYorN.SelectedIndex = ShammySettings.myPrefs.naruu;
            comboBoxEngibeltYorN.SelectedIndex = ShammySettings.myPrefs.Mengibelt;
            comboBoxBloodFury.SelectedIndex = ShammySettings.myPrefs.bloodfury;
            comboBoxBerserking.SelectedIndex = ShammySettings.myPrefs.berserking;
            comboBoxPauseKey.SelectedIndex = ShammySettings.myPrefs.PauseKey;
            switch (ShammySettings.myPrefs.PauseKey)
            {
                case 0:
                    ShammySettings.myPrefs.PauseKeys = ShammySettings.Keypress.None;
                    break;
                case 1:
                    ShammySettings.myPrefs.PauseKeys = ShammySettings.Keypress.LSHIFT;
                    break;
                case 2:
                    ShammySettings.myPrefs.PauseKeys = ShammySettings.Keypress.RSHIFT;
                    break;
                case 3:
                    ShammySettings.myPrefs.PauseKeys = ShammySettings.Keypress.LCTRL;
                    break;
                case 4:
                    ShammySettings.myPrefs.PauseKeys = ShammySettings.Keypress.RCTRL;
                    break;
                case 5:
                    ShammySettings.myPrefs.PauseKeys = ShammySettings.Keypress.LALT;
                    break;
                case 6:
                    ShammySettings.myPrefs.PauseKeys = ShammySettings.Keypress.RALT;
                    break;
            }



            checkBoxDisableMovement.Checked = ShammySettings.myPrefs.DisableMovement;
            checkBoxDisableFacing.Checked = ShammySettings.myPrefs.DisableFacing;
            checkBoxDisableTargetting.Checked = ShammySettings.myPrefs.Targetting;

            numericUpDownStartAoeAdds.Value = new decimal(ShammySettings.myPrefs.startaoe);
            numericUpDownHealingSurgePercent.Value = new decimal(ShammySettings.myPrefs.healingsurgepercent);
            numericUpDownHealthstonePercent.Value = new decimal(ShammySettings.myPrefs.healthstonepercent);
            numericUpDownLifeSpiritPercent.Value = new decimal(ShammySettings.myPrefs.LifeSpiritpercent);
            numericUpDownHealthpotionPercent.Value = new decimal(ShammySettings.myPrefs.healthpotionpercent);
            numericUpDownNaruuPercent.Value = new decimal(ShammySettings.myPrefs.naruupercent);
            numericUpDownEngiBeltPercent.Value = new decimal(ShammySettings.myPrefs.engibeltpercent);
            numericUpDownDrinkpercent.Value = new decimal(ShammySettings.myPrefs.drinkpercent);
            numericUpDownEatpercent.Value = new decimal(ShammySettings.myPrefs.eatpercent);
            numericUpDownEliteHelath.Value = new decimal(ShammySettings.myPrefs.elitehealth);
            numericUpDownHealingSurgeOOCpercent.Value = new decimal(ShammySettings.myPrefs.healingsurgeOOCpercent);
        }

        private void buttonSave_Click(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.Save();
            Close();
        }

        private void numericUpDownStartAoeAdds_ValueChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.startaoe = (int)numericUpDownStartAoeAdds.Value;
        }

        private void comboBoxSearingTotem_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.searingtotem = comboBoxSearingTotem.SelectedIndex;
        }

        private void comboBoxMagmaTotem_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.magmatotem = comboBoxMagmaTotem.SelectedIndex;
        }

        private void comboBoxFireElementalTotem_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.fireelementaltotem = comboBoxFireElementalTotem.SelectedIndex;
        }

        private void comboBoxThunderstorm_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.thunderstorm = comboBoxThunderstorm.SelectedIndex;
        }

        private void checkBoxDisableMovement_CheckedChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.DisableMovement = checkBoxDisableMovement.Checked;
        }

        private void checkBoxDisableFacing_CheckedChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.DisableFacing = checkBoxDisableFacing.Checked;
        }

        private void checkBoxDisableTargetting_CheckedChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.Targetting = checkBoxDisableTargetting.Checked;
        }

        private void comboBoxIntPotionsYesNo_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.IntPotionsYesNo = comboBoxIntPotionsYesNo.SelectedIndex;
        }

        private void comboBoxIntPotionsKind_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.IntPotionsKind = comboBoxIntPotionsKind.SelectedIndex;
        }

        private void comboBoxIntPotionsWhen_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.IntPotionsWhen = comboBoxIntPotionsWhen.SelectedIndex;
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.HealingStreamTotem = comboBox1.SelectedIndex;
        }

        private void comboBoxEarthElementalTotem_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.earthelementaltotem = comboBoxEarthElementalTotem.SelectedIndex;
        }

        private void comboBoxBloodlust_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.bloodlust = comboBoxBloodlust.SelectedIndex;
        }

        private void comboBoxAscendance_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.ascendance = comboBoxAscendance.SelectedIndex;
        }

        private void comboBoxEarthquake_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.earthquake = comboBoxEarthquake.SelectedIndex;
        }

        private void comboBoxTrinket1_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.Mtrinket1 = comboBoxTrinket1.SelectedIndex;
        }

        private void comboBoxTrinket2_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.Mtrinket2 = comboBoxTrinket2.SelectedIndex;
        }

        private void comboBoxEngiGloves_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.Mengivloves = comboBoxEngiGloves.SelectedIndex;
        }

        private void comboBoxalchemyFlaskYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.MAlchemyFlask = comboBoxalchemyFlaskYorN.SelectedIndex;
        }

        private void comboBoxIntFlaskYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.MIntellectFlask = comboBoxIntFlaskYorN.SelectedIndex;
        }

        private void comboBoxIntFlaskWhen_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.MIntellectFlaskWhen = comboBoxIntFlaskWhen.SelectedIndex;
        }

        private void comboBoxHealingSurgeYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.healingsurge = comboBoxHealingSurgeYorN.SelectedIndex;
        }

        private void numericUpDownHealingSurgePercent_ValueChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.healingsurgepercent = (int)numericUpDownHealingSurgePercent.Value;
        }

        private void comboBoxHealthstoneYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.healthstone = comboBoxHealthstoneYorN.SelectedIndex;
        }

        private void numericUpDownHealthstonePercent_ValueChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.healthstonepercent = (int)numericUpDownHealthstonePercent.Value;
        }

        private void comboBoxLifeSpiritYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.LifeSpirit = comboBoxLifeSpiritYorN.SelectedIndex;
        }

        private void numericUpDownLifeSpiritPercent_ValueChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.LifeSpiritpercent = (int)numericUpDownLifeSpiritPercent.Value;
        }

        private void comboBoxHelathpotionYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.healthpotion = comboBoxHelathpotionYorN.SelectedIndex;
        }

        private void numericUpDownHealthpotionPercent_ValueChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.healthpotionpercent = (int)numericUpDownHealthpotionPercent.Value;
        }

        private void comboBoxNaruuYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.naruu = comboBoxNaruuYorN.SelectedIndex;
        }

        private void numericUpDownNaruuPercent_ValueChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.naruupercent = (int)numericUpDownNaruuPercent.Value;
        }

        private void comboBoxEngibeltYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.Mengibelt = comboBoxEngibeltYorN.SelectedIndex;
        }

        private void numericUpDownEngiBeltPercent_ValueChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.engibeltpercent = (int)numericUpDownEngiBeltPercent.Value;
        }

        private void numericUpDownDrinkpercent_ValueChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.drinkpercent = (int)numericUpDownDrinkpercent.Value;
        }

        private void numericUpDownEatpercent_ValueChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.eatpercent = (int)numericUpDownEatpercent.Value;
        }

        private void comboBoxBloodFury_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.bloodfury = comboBoxBloodFury.SelectedIndex;
        }

        private void comboBoxBerserking_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.berserking = comboBoxBerserking.SelectedIndex;
        }

        private void comboBoxPauseKey_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.PauseKey = comboBoxPauseKey.SelectedIndex;
            switch (comboBoxPauseKey.SelectedIndex)
            {
                case 0:
                    ShammySettings.myPrefs.PauseKeys = ShammySettings.Keypress.None;
                    break;
                case 1:
                    ShammySettings.myPrefs.PauseKeys = ShammySettings.Keypress.LSHIFT;
                    break;
                case 2:
                    ShammySettings.myPrefs.PauseKeys = ShammySettings.Keypress.RSHIFT;
                    break;
                case 3:
                    ShammySettings.myPrefs.PauseKeys = ShammySettings.Keypress.LCTRL;
                    break;
                case 4:
                    ShammySettings.myPrefs.PauseKeys = ShammySettings.Keypress.RCTRL;
                    break;
                case 5:
                    ShammySettings.myPrefs.PauseKeys = ShammySettings.Keypress.LALT;
                    break;
                case 6:
                    ShammySettings.myPrefs.PauseKeys = ShammySettings.Keypress.RALT;
                    break;
            }
        }

        private void numericUpDownEliteHelath_ValueChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.elitehealth = (int)numericUpDownEliteHelath.Value;
        }

        private void comboBoxShamanisticRage_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.shamanisticrage = comboBoxShamanisticRage.SelectedIndex;
        }

        private void numericUpDownHealingSurgeOOCpercent_ValueChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.healingsurgeOOCpercent = (int)numericUpDownHealingSurgeOOCpercent.Value;
        }

        private void comboBoxLifebloodYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.lifebloodYorN = comboBoxLifebloodYorN.SelectedIndex;
        }

        private void comboBoxLifeblood_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShammySettings.myPrefs.lifeblood = comboBoxLifeblood.SelectedIndex;
        }
    }
}
